package com.yjf.ljr.activity;

import com.yjf.ljr.R;
import com.yjf.ljr.util.AppTransferDialog;
import com.yjf.ljr.view.DialogView;
import com.yjf.ljr.view.TransferDialog;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;


public class ConfirmationTransferActivity extends IjActivity implements OnClickListener {
	public static DialogView mDialogTransfering;// 转让取消弹框
												// dialog_confirmation_transfer
	private View mConfirmationtransferView;
	@ID("btApplicationTransfer")
	private Button mBtApplicationTransfer;
	@ID("btReturnChange")
	private Button mBtReturnChange;
	private Button mBtDialogConfirmationOk;
	private Button mBtDialogConfirmationCancel;
	@ID("tvConfirmPrice")
	private TextView mTvConfirmPrice;// 转让价格
	@ID("tvConfirmFee")
	private TextView mTvConfirmFee;// 转让手续费
	@ID("tvConfirmRate")
	private TextView mTvConfirmRate;// 预期年化利率
	@ID("tvConfirmDeadline")
	private TextView mTvConfirmDeadline;// 转让截止时间
	private String transferPrice;
	private String CanTransfee;
	private String CanTransbuyerDebtProfitRate;
	private String CanTransdeadline;
	private TransferDialog.Builder mBuilder;
	private String yjfPaypassUrl;
	private String tradeDetailId;
	
	private String mobile;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_confirmation_transfer);
		initControl();
	}

	private void initControl() {
		setTitleStr("确认转让");
		setLeftBtnClick();
		mBuilder = new TransferDialog.Builder(mContext);
		transferPrice = getIntent().getStringExtra("transferPrice");
		CanTransfee = getIntent().getStringExtra("CanTransfee");
		yjfPaypassUrl = getIntent().getStringExtra("yjfPaypassUrl");
		tradeDetailId = getIntent().getStringExtra("tradeDetailId");
		CanTransbuyerDebtProfitRate = getIntent().getStringExtra("CanTransbuyerDebtProfitRate");
		CanTransdeadline = getIntent().getStringExtra("CanTransdeadline");
		mobile = getIntent().getStringExtra("mobile");
		
		mTvConfirmPrice.setText(transferPrice);// 转让价格

		mTvConfirmFee.setText(CanTransfee);// 转让手续费
		mTvConfirmRate.setText(CanTransbuyerDebtProfitRate);// 预期年化利率
		mTvConfirmDeadline.setText(CanTransdeadline);// 转让截止时间

		mBtApplicationTransfer.setOnClickListener(this);
		mConfirmationtransferView = LayoutInflater.from(mContext).inflate(R.layout.dialog_confirmation_transfer, null);
		mBtDialogConfirmationOk = (Button) mConfirmationtransferView.findViewById(R.id.btDialogConfirmationOk);
		mBtDialogConfirmationCancel = (Button) mConfirmationtransferView.findViewById(R.id.btDialogConfirmationCancel);
		mBtDialogConfirmationOk.setOnClickListener(this);
		mBtDialogConfirmationCancel.setOnClickListener(this);
		mBtReturnChange.setOnClickListener(this);
		mDialogTransfering = new DialogView(mContext, mConfirmationtransferView);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.btApplicationTransfer:
			// mDialogTransfering.show();
			mBuilder.setPaypassUrl(yjfPaypassUrl);
			mBuilder.setTitle("支付密码");
			mBuilder.setmobile(mobile);
			mBuilder.setTradeDetailId(tradeDetailId);
			mBuilder.setAmount(transferPrice);
			mBuilder.create().show();
			break;
		case R.id.btDialogConfirmationOk:
			mDialogTransfering.dismiss();
			setResult(RESULT_OK);
			ConfirmationTransferActivity.this.finish();
			break;
		case R.id.btDialogConfirmationCancel:
			mDialogTransfering.dismiss();
			break;
		case R.id.btReturnChange:
			finish();
			break;
		default:
			break;
		}
	}

}
